The invention relates generally to database systems and, more particularly, to the generation of point-in-time consistent copies of one or more database objects without impacting the database's availability. Techniques in accordance with the invention may also be used during recovery operations to generate point-in-time consistent images of one or more recovered database objects, again without impacting the database's availability during creation of the recovered database object.
A database is, fundamentally, a computerized record-keeping system in which large amounts of information may be stored in a structured manner for ease of subsequent retrieval and processing. Large databases such as the DB2® database from the International Business Machines Corporation of Armonk, N.Y., are typically managed through a database management system (“DBMS”). A DBMS, in turn, provides four primary functions: management of physical storage; a user interface (e.g., the Structured Query Language, “SQL”); data security (e.g., user passwords and view restriction policies); and (4) data consistency or integrity.
There are two types of consistency—physical and transactional. Physical consistency refers to the integrity between physical pages of storage. For example, index pointers must be consistent with the data pages to which they point, a pointer record and the overflow record it points to on another page must be consistent, an index non-leaf page and the leaf page it points to must be consistent, and any DBMS defined referential integrity constraints established between database objects must be maintained in the face of data updates. Transactional consistency refers to the condition wherein a database's data is consistent across (although not necessarily during) a transaction. A transaction is generally defined as all database operations (e.g., updates) associated with a single logical action. To permit the DBMS to track transactions comprising multiple operations, and to maintain the database's integrity in light of such operations (i.e., transactional consistency), all database operations related to a transaction are grouped into a single unit of work (“UOW”). Until all updates in a UOW are committed (that is, applied to and made part of the database object to which they are directed and such action noted in the DBMS's log files), the UOW is said to be “inflight.”
It is important that when generating a copy of a database (or a portion thereof) the resulting copy is both physically and transactionally consistent. To ensure this consistency, prior art database copy techniques (1) block write-access to the database objects being copied, including all referentially related objects, (2) wait for all inflight UOW to complete, and (3) copy the database objects. While this process generates a consistent copy of the database objects as of the time the copy operation was initiated, it prevents users from updating the those database objects at least until the inflight UOW are complete. This can be a significant drawback for large or complex databases and/or those databases that experience large update volumes.
Another prior art technique for generating a consistent database copy relies on the DBMS periodically quiescing the database. By this it is meant that the DBMS periodically (at user specified intervals) blocks user access to the database, allows pending inflight UOW to complete and then records in its logs or system catalog table the time at which this operation is complete and the database is consistent. A subsequent recovery operation can restore the database to a prior consistent state either by applying database undo commands backward from the current time to the desired point in time, or by restoring a prior copy and applying database redo commands forward up until the desired point in time. While this technique can recover a damaged database, it relies on the use of quiesce points in a DBMS's logs which are intrusive to create. In addition, the ability of a user to recover a consistent copy of their database is limited to the temporal granularity of their quiesce actions—the more often a quiesce is performed, the finer the time resolution for recovery operations, but the more often users are blocked from updating the data because of quiesce operations.
Yet another prior art technique for creating a consistent database copy involves (1) specifying a point in time at which the consistent copy is to be created, (2) performing a DBMS-wide restart to create log records to remove the effect of UOW that were in inflight at the specified point in time, (3) restoring a copy of the database made prior to the specified point in time, and (4) performing another operation to apply the log records created during step 2 to the restored copy generated during step 3. In a DB2® environment, this is referred to as a conditional restart. While the result is a copy of the targeted database that is both physically and transactionally consistent, all databases managed by the DBMS restarted are taken off-line during the restart operation. As one DBMS may manage multiple databases, each of which may be operationally significant, this approach can cause massive outages for users.
Thus, it would be beneficial to provide methods and devices to generate copies of a database (or portions thereof) that are physically and transactionally consistent and which do not cause user access outages during the operation. It would further be beneficial to provide methods and devices to generate an image of a database (or portions thereof) that is physically and transactionally consistent at an arbitrary specified point in time and which do not cause user access outages during the operation.